#pragma once
#include "CentralCanvasBase.h"
#include "cv.h"
#include "highgui.h"
#include "ResourceLocker.h"
class CvCapture;
class CVideoCanvas:
	public OCEANUI::CCentralCanvasBase
{
		
	
	Q_OBJECT
public:

	friend void __cdecl videoPlayThreadCallBack(LPVOID pData);

	CVideoCanvas(OCEANUI::CMainWindowBase* parent);

	~CVideoCanvas(void);

	void initData(void* pData);

	bool play();

	bool pause();

	bool resume();

	bool stop();

	inline CvCapture* getCapture()
	{
		return pCapture_;
	}

signals:
	void SigUpdate();

protected:
	void syncVideoImage(IplImage* pImg);

	void paintEvent(QPaintEvent *event);
private:
	CvCapture* pCapture_;

	OCEANUI::CMainWindowBase* parent;

	IplImage* pCurrentImg_;

	double fps_;
	
	CRITICAL_SECTION imagelock_;
	
};
